#ifndef QTFORMULABAR_H
#define QTFORMULABAR_H

#include <QWidget>
#include <QPixmap>
#include <QVector>
#include "QtRendersetting.h"
#include "QtStra_StrategyInfo.h"



class QtFormulaBar : public QWidget
{
	Q_OBJECT

public:
	QtFormulaBar(BusiCoord* pBusiCoord, QtStraStrategyInfo* barinfo = NULL, QWidget *parent = 0);


	void RefreshBuffer();

	void MousePress(QPoint& point);

	void MouseMove(QPoint& point);

	void MouseRelease(QPoint& point);


protected:
	void paintEvent(QPaintEvent *event);
	void resizeEvent(QResizeEvent *event);
	void keyPressEvent(QKeyEvent *event);
	//void mousePressEvent(QMouseEvent *event);
	//void mouseMoveEvent(QMouseEvent *event);
	//void mouseReleaseEvent(QMouseEvent *event);

private:


	bool DrawGrid(QPainter *painter);

	bool DrawBars(QPainter *painter);

	bool minAndmaxY(int minXIndex, int maxXIndex, double& minY, double& maxY);



private:
	//GetBusiRect
	enum { TopMargin = 50, BottomMargin = 50};
	QRect* m_pBusiRect;

	//BusiCoord
	BusiCoord* m_pBusiCoord;



	typedef enum { NotShow = 0, CursorShow = 1, VerticalShow = 2} MouseShow;
	MouseShow m_eMouseShow;
	QPoint m_cursorPoint;


	QPixmap pixmap;





private:

	void UpdateBarInfoWidget(bool bupdate);
	

private:
	//bar Dock and elements in it
	QtStraStrategyInfo* m_barinfo;


};



#endif
